<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
    <link rel="stylesheet" type="text/css" href="style.css">

    <title>Search for a File</title>
</head>

<body>
    <div class="main">
    <h1>Search for your File:</h1>
        <form action="" method="post">
            Username:<input type="text" name="user" class="no"><br>Password<input type="password" name="userPassword" class="no"><br> <input name="Submit" type="submit" class="no" value="Submit">
        </form>

        <div class="yes">
            <?php
            /*THIS IS SEARCH.PHP*/
            require('sql.php');
            require ('encrypt.php');
            $password1 = $_POST['userPassword'];
			$password2 = eliteEncrypt($password1);
            if(isset($_POST['Submit'])){
                /*Select the DB */
                mysql_select_db("UPLOAD", $connect);
                $sql = mysql_query("SELECT * FROM upload WHERE owner = '$_POST[user]' AND password = '$password2'");
                while($row = mysql_fetch_array($sql))
                {
                    echo 'Download: <a target="_blank" href=/upload/download.php?id='.$row['id'].'>'.$row['name'].'</a><br>';
                }
            }
            ?>
        </div>
    </div>
</body>
</html>
